<?php

class My_Calendar_Event
{
    /**
     * @var Zend_Date
     */
    protected $date;
    /**
     * @var mixed
     */
    protected $contents;
    
    /**
     * @param Zend_Date $date
     * @param mixed $contents 
     */
    public function __construct(Zend_Date $date, $contents)
    {
        $this->date = $date;
        $this->contents = $contents;
    }
    
    /**
     * @param Zend_Date|string $date
     * @param mixed $contents
     * @return My_Calendar_Event 
     */
    public static function factory($date, $contents)
    {
        if (!($date instanceof Zend_Date))
        {
            $date = new Zend_Date($date, Zend_Date::ISO_8601);
        }
        return new self($date, $contents);
    }
    
    /**
     * @return Zend_Date
     */
    public function getDate($returnString = false)     
    {
        $date = $this->date;
        if (true == $returnString) $date = $date->get ('Y-MM-dd');
        return $date;
    }
    
    /**
     *
     * @return string
     */
    public function getTime()
    {
        return $this->date->get(Zend_Date::TIME_SHORT);
    }
    
    /**
     * @param Zend_Date|string $date
     * @return My_Calendar_Event 
     */
    public function setDate($date)
    {
        if (!($date instanceof Zend_Date))
        {
            $date = new Zend_Date($date, Zend_Date::ISO_8601);
        }
        $this->date = $date;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getContents()
    {
        return $this->contents;
    }

    /**
     * @param mixed $contents
     * @return My_Calendar_Event 
     */
    public function setContents($contents)
    {
        $this->contents = $contents;
        return $this;
    }


}
